1. Field of the Invention
This invention is related to image processing methods and apparatuses. More specifically, this invention is related to methods and apparatuses for sharpening images.
2. Description of the Prior Art
Sharpening an image is adjusting the gray levels of pixels in the image, so as to increase differences between gray levels of adjacent pixels. Generally speaking, enhancing sharpness can make an image clearer and brighter. Most image processing methods perform a sharpening step with a spatial mask. During the process of sharpening, the gray levels of pixels within the spatial mask are respectively multiplied with by a particular weighting and further processed.
Please refer to FIG. 1. FIG. 1(A) shows three pixels A, B and C on the same horizontal line in one image. FIG. 1(B) through FIG. 1(D) show several spatial masks can be applied to the pixels in FIG. 1(A). Assume the gray levels of pixels A, B and C are G1, G2 and G3, respectively. After being sharpened with the spatial mask in FIG. 1(B), the new gray level (G2′) of pixel B is:
                                          G            ⁢                                                  ⁢                          2              ′                                =                                    1              2                        ⁢                          (                                                4                  *                  G                  ⁢                                                                          ⁢                  2                                -                                  G                  ⁢                                                                          ⁢                  1                                -                                  G                  ⁢                                                                          ⁢                  3                                            )                                      ;                            (                  Equation          ⁢                                          ⁢          1                )            
After being sharpened with the spatial mask in FIG. 1(C), the new gray level (G2′) of pixel B is:
                                          G            ⁢                                                  ⁢                          2              ′                                =                                    1              4                        ⁢                          (                                                6                  *                  G                  ⁢                                                                          ⁢                  2                                -                                  G                  ⁢                                                                          ⁢                  1                                -                                  G                  ⁢                                                                          ⁢                  3                                            )                                      ;                            (                  Equation          ⁢                                          ⁢          2                )            
The rest may be deduced by analogy. After being sharpened with the spatial mask in FIG. 1(D), the new gray level (G2′) of pixel B is:
                              G          ⁢                                          ⁢                      2            ′                          =                              1            8                    ⁢                                    (                                                10                  *                  G                  ⁢                                                                          ⁢                  2                                -                                  G                  ⁢                                                                          ⁢                  1                                -                                  G                  ⁢                                                                          ⁢                  3                                            )                        .                                              (                  Equation          ⁢                                          ⁢          3                )            
The spatial mask in FIG. 1(B) can be represented as (½)×[−1 4−1]; the spatial mask in FIG. 1(C) can be represented as (¼)×[−1 6−1]; the spatial mask in FIG. 1(D) can be represented as (⅛)×[−1 10−1].
Different spatial masks correspond to different sharpening effects. For example, adopting the spatial mask shown in FIG. 1(B) can generate a sharper image. On the contrary, adopting the spatial mask shown in FIG. 1(D) generates a less sharp image. That is to say, to arrange the spatial masks in sequence according to their corresponding sharpening effects has the result: FIG. 1(B)>FIG. 1(C)>FIG. 1(D).
Please refer to FIG. 2. FIG. 2(A) shows five pixels A, B, C, D and E on the same horizontal line in one image; FIG. 2(B) shows a spatial mask can be applied to the pixels in FIG. 2(A). Assume the gray levels of pixels A, B, C, D and E are G1, G2, G3, G4 and G5, respectively. After being sharpened with the spatial mask in FIG. 2(B), the new gray level (G3′) of pixel C is:
                              G          ⁢                                          ⁢                      3            ′                          =                              1            4                    ⁢                                    (                                                8                  *                  G                  ⁢                                                                          ⁢                  3                                -                                  G                  ⁢                                                                          ⁢                  1                                -                                  G                  ⁢                                                                          ⁢                  2                                -                                  G                  ⁢                                                                          ⁢                  4                                -                                  G                  ⁢                                                                          ⁢                  5                                            )                        .                                              (                  Equation          ⁢                                          ⁢          4                )            
A spatial mask can also be a two-dimension matrix shown in FIG. 3(B). Assume the gray levels of pixels A˜I in FIG. 3(A) are G1˜G9, respectively. After being sharpened with the spatial mask in FIG. 3(B), the new gray level (G5′) of pixel E is:
                              G          ⁢                                          ⁢                      5            ′                          =                              1            4                    ⁢                                    (                                                8                  *                  G                  ⁢                                                                          ⁢                  5                                -                                  G                  ⁢                                                                          ⁢                  2                                -                                  G                  ⁢                                                                          ⁢                  4                                -                                  G                  ⁢                                                                          ⁢                  6                                -                                  G                  ⁢                                                                          ⁢                  8                                            )                        .                                              (                  Equation          ⁢                                          ⁢          5                )            
If an image processing process performs sharpening with digital circuits, designers usually set the divisor in the sharpening equations equal to a power of 2, so as to simplify the circuits and increase calculating efficiencies. For example, the divisors in the aforementioned equations are set equal to 2, 4 and 8.
Although setting the divisor equal to a power of 2 can simplify digital circuits, the flexibility of sharpening levels is decreased. For instance, because 5, 6 and 7 are not powers of 2, three possible spatial masks, (⅕)×[−1 7−1], (⅙)×[−1 8−1], and ( 1/7)×[−1 9−1], are not used in prior arts.
Besides, most images contain clearer parts and obscurer parts at the same time. That is to say, some parts have higher sharpness and some parts have lower sharpness. If a single spatial mask is used to adjust such an image, the edges of parts with higher sharpness may have abnormal side effects. Please refer to FIG. 4, which illustrates ideal and actual sharpened results. FIG. 4(A) shows the gray levels on the same horizontal line in one image before sharpening; FIG. 4(B) shows the gray levels as an ideal sharpened result; FIG. 4(C) shows the gray levels as an actual sharpened result. As shown in FIG. 4(C), the over-shootings at the corners are side effects that seriously decrease image qualities.